<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网页文章结构提取器</title>
    <!-- 添加 GitHub Markdown 样式 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown.min.css">
    <!-- 添加代码高亮样式 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
    <!-- 自定义样式 -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <!-- Marked.js 用于 Markdown 渲染 -->
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <!-- highlight.js 用于代码高亮 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
</head>
<body>
    <div class="container">
        <header>
            <h1>网页文章结构提取器</h1>
            <p>输入网页链接，自动提取文章结构并生成 Markdown 大纲</p>
        </header>

        <main>
            <section class="input-section">
                <div class="url-input">
                    <input type="url" id="articleUrl" placeholder="请输入文章URL（支持知乎、微信等平台）" required>
                    <button id="generateBtn">提取文章结构</button>
                </div>
                <div class="loading" id="loading" style="display: none;">
                    <div class="spinner"></div>
                    <p>正在分析文章结构，请稍候...</p>
                </div>
                <div class="error" id="error" style="display: none;">
                    <p>发生错误：<span id="errorMessage"></span></p>
                </div>
            </section>

            <section class="preview-section">
                <div class="preview-header">
                    <h2>文章结构预览</h2>
                    <div class="preview-actions">
                        <button id="copyBtn" class="secondary-button" disabled>复制内容</button>
                        <button id="exportBtn" disabled>导出 Markdown</button>
                    </div>
                </div>
                <div class="preview-container markdown-body">
                    <div id="markdown-content"></div>
                </div>
            </section>
        </main>

        <footer>
            <p>基于 browser-use 开发 | <a href="https://github.com/yourusername/article-analyzer" target="_blank">GitHub</a></p>
        </footer>
    </div>

    <!-- 自定义脚本 -->
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
</body>
</html> 